Skip to content

Add conversion to convert from Seq to Tensor - #183

Merged
marcelluethi merged 2 commits into
dimwit-dev:mainfrom
marcelluethi:seq-conversions
Nov 18, 2026
Merged

marcelluethi merged 2 commits into
dimwit-dev:mainfrom
marcelluethi:seq-conversions

Conversation

@marcelluethi

Copy link
Copy Markdown
Contributor

It is often useful to convert a sequence of numbers to a tensor in a unceremonious fashion.
A common use case is, for example, the plotting of column from a DataFrame using PlotWit.

Using the fromArray factory method on tensor is possible but cumbersome.

This PR proposes to make extension methods available, that simplify this conversion. They need to be imported using

import dimwit.conversions.*

Once imported, it becomes possible to write:

Seq(1f, 2f, 3f).toTensor1(Axis[L])

or

Seq(1f, 2f, 3f).toTensor(Axis[L], VType[Float64])

@marcelluethi
marcelluethi merged commit a4ea942 into dimwit-dev:main Nov 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants